import request from '@/utils/request'

export const getEmployees = params => request.get('/sys/user', { params })

// blob 文件流格式, 二进制, File 就是 Blob 的子类
// responseType: 设置相应类型
export const exportExcel = () => request.get('/sys/user/export', { responseType: 'blob' })

export const getTemplate = () => request.get('/sys/user/import/template', { responseType: 'blob' })

export const importExcel = data => request.post('/sys/user/import', data)

export const delEmployee = id => request.delete(`/sys/user/${id}`)

export const addEmployee = data => request.post(`/sys/user`, data)

export const getEmployeeDetail = id => request.get(`/sys/user/${id}`)

export const updateEmployee = data => request.put(`/sys/user/${data.id}`, data)

export const assignRoles = data => request.put(`/sys/user/assignRoles`, data)

